﻿<%@ Page Title="" Language="C#" MasterPageFile="~/SiteMaster.Master" AutoEventWireup="true"
    CodeBehind="Material.aspx.cs" Inherits="KCL.Management.Material" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
<%@ Register Assembly="System.Web.DynamicData, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
    Namespace="System.Web.DynamicData" TagPrefix="cc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <style type="text/css">
        .style9
        {
            width: 110px;
        }
        .style11
        {
            width: 211px;
        }
        .style12
        {
            width: 218px;
        }
        .style14
        {
            width: 145px;
        }
    </style>
    <link href="../styles/css/style.css" rel="stylesheet" type="text/css" />
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">
    </asp:ToolkitScriptManager>
    <asp:SqlDataSource ID="srcProduct" runat="server" ConnectionString="<%$ ConnectionStrings:KCLConnectionString %>"
        SelectCommand="SELECT id, name FROM Product WHERE isActive = 1 ORDER BY name">
    </asp:SqlDataSource>
    <asp:SqlDataSource ID="srcColor" runat="server" ConnectionString="<%$ ConnectionStrings:KCLConnectionString %>"
        SelectCommand="SELECT [id], [name] FROM [Color] WHERE [isActive] = 1 ORDER BY [name]">
    </asp:SqlDataSource>
    <asp:SqlDataSource ID="srcSize" runat="server" ConnectionString="<%$ ConnectionStrings:KCLConnectionString %>"
        SelectCommand="SELECT id, length + ' x ' + width size FROM Size WHERE isActive = 1 ORDER BY size">
    </asp:SqlDataSource>
    <asp:SqlDataSource ID="srcThickness" runat="server" ConnectionString="<%$ ConnectionStrings:KCLConnectionString %>"
        SelectCommand="SELECT id, thick FROM Thickness WHERE isActive = 1 ORDER BY thick">
    </asp:SqlDataSource>
    <asp:SqlDataSource ID="srcMadeIn" runat="server" ConnectionString="<%$ ConnectionStrings:KCLConnectionString %>"
        SelectCommand="SELECT id, name FROM MadeIn WHERE isActive = 1 ORDER BY name">
    </asp:SqlDataSource>
    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
        <ContentTemplate>
            <div class="boxed">
                <h2 class="title" style="text-align: left; font-weight: bold; padding-left: 20px;
                    padding-top: 10px; height: 30px">
                    Quản lý nguyên liệu
                </h2>
                <table style="padding: 15px; width: 955px; margin-bottom: 15px;">
                    <tr>
                        <td class="style14">
                            Mã nguyên liệu chọn</td>
                        <td class="style11">
                            &nbsp;
                            <asp:Label ID="lblMaterialCode" runat="server" Font-Bold="True"></asp:Label>
                        </td>
                        <td class="style9">
                            Mã nguyên liệu mới</td>
                        <td class="style12">
                            &nbsp;
                            <asp:Label ID="lblNextMaterialCode" runat="server" Font-Bold="True"></asp:Label>
                        </td>
                        <td>
                            <asp:Label ID="lblMessageMaterial" runat="server" Font-Italic="True"></asp:Label>
                        </td>
                    </tr>
                    <tr>
                        <td class="style14">
                            Tên nguyên liệu
                        </td>
                        <td class="style11">
                            <asp:TextBox ID="txtMaterialName" runat="server"></asp:TextBox>
                        </td>
                        <td class="style9">
                            Sản phẩm
                        </td>
                        <td class="style12">
                            <asp:ComboBox ID="cboProduct" runat="server" AutoCompleteMode="SuggestAppend" DataSourceID="srcProduct"
                                DataTextField="name" DataValueField="id" DropDownStyle="DropDownList" MaxLength="0"
                                Style="display: inline;">
                            </asp:ComboBox>
                            <asp:ImageButton ID="imgbtnAddProduct" runat="server" ImageUrl="~/styles/images/add.png" />
                        </td>
                        <td align="center" rowspan="2">
                            <asp:Button ID="btnAddMaterial" runat="server" Height="30px" OnClick="btnAddMaterial_Click"
                                Text="Thêm" Width="150px" />
                        </td>
                    </tr>
                    <tr>
                        <td class="style14">
                            Loại màu
                        </td>
                        <td class="style11">
                            <asp:ComboBox ID="cboColor" runat="server" DataSourceID="srcColor" DataTextField="name"
                                DataValueField="id" MaxLength="0" Style="display: inline;" AutoCompleteMode="SuggestAppend"
                                DropDownStyle="DropDownList">
                            </asp:ComboBox>
                            <asp:ImageButton ID="imgbtnAddColor" runat="server" ImageUrl="~/styles/images/add.png" />
                        </td>
                        <td class="style9">
                            Kích thước
                        </td>
                        <td class="style12">
                            <asp:ComboBox ID="cboSize" runat="server" AutoCompleteMode="SuggestAppend" DataSourceID="srcSize"
                                DataTextField="size" DataValueField="id" DropDownStyle="DropDownList" MaxLength="0"
                                Style="display: inline;">
                            </asp:ComboBox>
                            <asp:ImageButton ID="imgbtnAddSize" runat="server" ImageUrl="~/styles/images/add.png" />
                        </td>
                    </tr>
                    <tr>
                        <td class="style14">
                            Độ dày
                        </td>
                        <td class="style11">
                            <asp:ComboBox ID="cboThickness" runat="server" AutoCompleteMode="SuggestAppend" DataSourceID="srcThickness"
                                DataTextField="thick" DataValueField="id" DropDownStyle="DropDownList" MaxLength="0"
                                Style="display: inline;">
                            </asp:ComboBox>
                            <asp:ImageButton ID="imgbtnAddThickness" runat="server" ImageUrl="~/styles/images/add.png" />
                        </td>
                        <td class="style9">
                            Xuất xứ
                        </td>
                        <td class="style12">
                            <asp:ComboBox ID="cboMadeIn" runat="server" AutoCompleteMode="SuggestAppend" DataSourceID="srcMadeIn"
                                DataTextField="name" DataValueField="id" DropDownStyle="DropDownList" MaxLength="0"
                                Style="display: inline;">
                            </asp:ComboBox>
                            <asp:ImageButton ID="imgbtnAddMadeIn" runat="server" ImageUrl="~/styles/images/add.png" />
                        </td>
                        <td align="center" valign="top">
                            <asp:Button ID="btnUpdateMaterial" runat="server" Height="30px" OnClick="btnUpdateMaterial_Click"
                                Text="Chỉnh Sửa" Width="150px" />
                        </td>
                    </tr>
                </table>
            </div>
            <div class="boxed">
                <h2 class="title" style="text-align: left; font-weight: bold; padding-left: 20px;
                    padding-top: 10px; height: 30px">
                    Danh sách nguyên liệu
                </h2>
                <asp:GridView ID="dgvMaterial" runat="server" AutoGenerateColumns="False" BackColor="White"
                    BorderColor="#DEDFDE" BorderStyle="None" BorderWidth="1px" CellPadding="4" DataSourceID="srcMaterial"
                    EnableModelValidation="True" ForeColor="Black" GridLines="Vertical" Width="950px"
                    AllowPaging="True" DataKeyNames="code" OnSelectedIndexChanged="dgvMaterial_SelectedIndexChanged"
                    PageSize="20">
                    <AlternatingRowStyle BackColor="White" />
                    <Columns>
                        <asp:CommandField SelectText="Chọn" ShowSelectButton="True" />
                        <asp:BoundField DataField="code" HeaderText="Mã nguyên liệu" SortExpression="code" />
                        <asp:BoundField DataField="name" HeaderText="Tên nguyên liệu" SortExpression="name" />
                        <asp:BoundField DataField="product" HeaderText="Sản phẩm" SortExpression="product" />
                        <asp:BoundField DataField="color" HeaderText="Màu loại" SortExpression="color" />
                        <asp:BoundField DataField="size" HeaderText="Kích thước" SortExpression="size">
                            <ItemStyle HorizontalAlign="Right" />
                        </asp:BoundField>
                        <asp:BoundField DataField="thickness" HeaderText="Độ dày" SortExpression="thickness">
                            <ItemStyle HorizontalAlign="Right" />
                        </asp:BoundField>
                        <asp:BoundField DataField="madein" HeaderText="Xuất xứ" SortExpression="madein" />
                        <asp:BoundField DataField="quantity" HeaderText="Số lượng" SortExpression="quantity">
                            <ItemStyle HorizontalAlign="Right" />
                        </asp:BoundField>
                        <asp:TemplateField ShowHeader="False">
                            <ItemTemplate>
                                <asp:LinkButton Style="color: Black" ID="LinkButton1" runat="server" CausesValidation="False"
                                    CommandName="Delete" Text="Xóa" OnClientClick="javascript:return confirm('Bạn có chắc muốn xóa dòng này?');"></asp:LinkButton>
                            </ItemTemplate>
                        </asp:TemplateField>
                    </Columns>
                    <FooterStyle BackColor="#CCCC99" />
                    <HeaderStyle BackColor="#FFFFCC" Font-Bold="True" ForeColor="#CC0000" />
                    <PagerStyle BackColor="#F7F7DE" ForeColor="Black" HorizontalAlign="Right" />
                    <RowStyle BackColor="#F7F7DE" />
                    <SelectedRowStyle BackColor="#CE5D5A" Font-Bold="True" ForeColor="White" />
                </asp:GridView>
            </div>
            <asp:ObjectDataSource ID="srcMaterial" runat="server" DataObjectTypeName="KCL.Code.Material"
                DeleteMethod="Delete" SelectMethod="GetAllMaterialViews" TypeName="KCL.Code.Business.MaterialServices">
            </asp:ObjectDataSource>
            <div id="PopupProduct" class="boxed" style="display: none; width: 300px; height: 150px">
                <h2 class="title">
                    Nhập sản phẩm</h2>
                <div class="content">
                    <table style="width: 100%;">
                        <tr>
                            <td>
                                Tên sản phẩm:
                            </td>
                            <td>
                                <asp:TextBox ID="txtProductName" runat="server"></asp:TextBox>
                            </td>
                        </tr>
                        <tr>
                            <td>
                            </td>
                            <td>
                                <asp:Label ID="lblMessageProduct" runat="server" Font-Italic="True"></asp:Label>
                            </td>
                        </tr>
                        <tr align="center">
                            <td colspan="2">
                                <asp:Button ID="btnAddProduct" runat="server" Text="Thêm" Width="80px" OnClick="btnAddProduct_Click" />
                                &nbsp;
                                <asp:Button ID="btnCancelProduct" runat="server" Text="Đóng" Width="80px" />
                            </td>
                        </tr>
                    </table>
                </div>
            </div>
            <asp:ModalPopupExtender ID="ModalPopupExtender5" runat="server" TargetControlID="imgbtnAddProduct"
                PopupControlID="PopupProduct" CancelControlID="btnCancelProduct" BackgroundCssClass="PopupBackGround">
            </asp:ModalPopupExtender>
            <div id="PopupColor" class="boxed" style="display: none; width: 300px; height: 150px">
                <h2 class="title">
                    Nhập loại màu</h2>
                <div class="content">
                    <table style="width: 100%;">
                        <tr>
                            <td>
                                Tên loại màu:
                            </td>
                            <td>
                                <asp:TextBox ID="txtColorName" runat="server"></asp:TextBox>
                            </td>
                        </tr>
                        <tr>
                            <td>
                            </td>
                            <td>
                                <asp:Label ID="lblMessageColor" runat="server" Font-Italic="True"></asp:Label>
                            </td>
                        </tr>
                        <tr align="center">
                            <td colspan="2">
                                <asp:Button ID="btnAddColor" runat="server" Text="Thêm" Width="80px" OnClick="btnAddColor_Click" />
                                &nbsp;
                                <asp:Button ID="btnCancelColor" runat="server" Text="Đóng" Width="80px" />
                            </td>
                        </tr>
                    </table>
                </div>
            </div>
            <asp:ModalPopupExtender ID="ModalPopupExtender1" runat="server" TargetControlID="imgbtnAddColor"
                PopupControlID="PopupColor" CancelControlID="btnCancelColor" BackgroundCssClass="PopupBackGround">
            </asp:ModalPopupExtender>
            <div id="PopupSize" class="boxed" style="display: none; width: 300px; height: 150px">
                <h2 class="title">
                    Nhập kích thước</h2>
                <div class="content">
                    <table style="width: 100%;">
                        <tr>
                            <td>
                                Chiều dài:
                            </td>
                            <td>
                                <asp:TextBox ID="txtLength" runat="server"></asp:TextBox>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                Chiều rộng:
                            </td>
                            <td>
                                <asp:TextBox ID="txtWidth" runat="server"></asp:TextBox>
                            </td>
                        </tr>
                        <tr>
                            <td>
                            </td>
                            <td>
                                <asp:Label ID="lblMessageSize" runat="server" Font-Italic="True"></asp:Label>
                            </td>
                        </tr>
                        <tr align="center">
                            <td colspan="2">
                                <asp:Button ID="btnAddSize" runat="server" Text="Thêm" Width="80px" OnClick="btnAddSize_Click" />
                                &nbsp;
                                <asp:Button ID="btnCancelSize" runat="server" Text="Đóng" Width="80px" />
                            </td>
                        </tr>
                    </table>
                </div>
            </div>
            <asp:ModalPopupExtender ID="ModalPopupExtender2" runat="server" TargetControlID="imgbtnAddSize"
                PopupControlID="PopupSize" CancelControlID="btnCancelSize" BackgroundCssClass="PopupBackGround">
            </asp:ModalPopupExtender>
            <div id="PopupThickness" class="boxed" style="display: none; width: 300px; height: 150px">
                <h2 class="title">
                    Nhập độ dày</h2>
                <div class="content">
                    <table style="width: 100%;">
                        <tr>
                            <td>
                                Nhập độ dày:
                            </td>
                            <td>
                                <asp:TextBox ID="txtThicknessName" runat="server"></asp:TextBox>
                            </td>
                        </tr>
                        <tr>
                            <td>
                            </td>
                            <td>
                                <asp:Label ID="lblMessageThick" runat="server" Font-Italic="True"></asp:Label>
                            </td>
                        </tr>
                        <tr align="center">
                            <td colspan="2">
                                <asp:Button ID="btnAddThickness" runat="server" Text="Thêm" Width="80px" OnClick="btnAddThickness_Click" />
                                &nbsp;
                                <asp:Button ID="btnCancelThickness" runat="server" Text="Đóng" Width="80px" />
                            </td>
                        </tr>
                    </table>
                </div>
            </div>
            <asp:ModalPopupExtender ID="ModalPopupExtender3" runat="server" TargetControlID="imgbtnAddThickness"
                PopupControlID="PopupThickness" CancelControlID="btnCancelThickness" BackgroundCssClass="PopupBackGround">
            </asp:ModalPopupExtender>
            <div id="PopupMadeIn" class="boxed" style="display: none; width: 300px; height: 150px">
                <h2 class="title">
                    Nhập xuất xứ</h2>
                <div class="content">
                    <table style="width: 100%;">
                        <tr>
                            <td>
                                Nhập xuất xứ:
                            </td>
                            <td>
                                <asp:TextBox ID="txtMadeIn" runat="server"></asp:TextBox>
                            </td>
                        </tr>
                        <tr>
                            <td>
                            </td>
                            <td>
                                <asp:Label ID="lblMessageMadeIn" runat="server" Font-Italic="True"></asp:Label>
                            </td>
                        </tr>
                        <tr align="center">
                            <td colspan="2">
                                <asp:Button ID="btnAddMadeIn" runat="server" Text="Thêm" Width="80px" OnClick="btnAddMadeIn_Click" />
                                &nbsp;
                                <asp:Button ID="btnCancelMadeIn" runat="server" Text="Đóng" Width="80px" />
                            </td>
                        </tr>
                    </table>
                </div>
            </div>
            <asp:ModalPopupExtender ID="ModalPopupExtender4" runat="server" TargetControlID="imgbtnAddMadeIn"
                PopupControlID="PopupMadeIn" CancelControlID="btnCancelMadeIn" BackgroundCssClass="PopupBackGround">
            </asp:ModalPopupExtender>
        </ContentTemplate>
    </asp:UpdatePanel>
</asp:Content>
